package com.nkzy.filter; /**
 * Create by 王建烨 on 2022/4/2 8:12
 **/


import javax.servlet.*;
import javax.servlet.annotation.*;
import java.io.IOException;

public class SecondFilter implements Filter {
    public void init(FilterConfig config) throws ServletException {
        // 初始化方法
        System.out.println("初始化 Second Filter 嗨害嗨！");
    }

    public void destroy() {
        // 销毁方法
        System.out.println("销毁 Second Filter 嗨害嗨！");
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
        // 放行
        System.out.println("进入 Second Filter 嗨害嗨！");
        chain.doFilter(request, response);
        System.out.println("离开 Second Filter 嗨害嗨！");
    }
}
